<h1>New purchase</h1>

<% form_for(@purchase) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :receipt %><br />
    <%= select("purchase","receipt_id",Receipt.find(:all).collect {|r| [r.rDate.to_s.concat(' - ').concat(r.store.company.name),r.id]}) %>
  </p>
  <p>
    <%= f.label :item %><br />
    <%= select("purchase","item_id",Item.find(:all).collect {|i| [i.name,i.id]}) %>
  </p>
  <p>
    <%= f.label :quantity %><br />
    <%= f.text_field :quantity %>
  </p>
  <p>
    <%= f.label :price %><br />
    <%= f.text_field :price %>
  </p>
  <p>
    <%= f.label :tax_rate %><br />
    <%= f.text_field :tax_rate %>
  </p>
  <p>
    <%= f.label :sale %><br />
    <%= f.check_box :sale %>
  </p>
  <p>
    <%= f.label :coupon %><br />
    <%= f.text_field :coupon %>
  </p>
  <p>
    <%= f.label :notes %><br />
    <%= f.text_field :notes %>
  </p>
  <p>
    <%= f.submit "Create" %>
  </p>
<% end %>

<%= link_to 'Back', purchases_path %>
